﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class UserControls_ImgSelector : System.Web.UI.UserControl,ITextControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.ClientScript.IsClientScriptIncludeRegistered(Page.GetType(), "fckpick.js"))
        {
            Page.ClientScript.RegisterClientScriptInclude(Page.GetType(), "fckpick.js", Request.ApplicationPath.TrimEnd('/') + "/JS/fckpick.js");
        }
        SelButton.OnClientClick = "BrowserServer('"+TxtVal.ClientID+"','"+PV.ClientID+"');return false;";
    }

    public string Value
    {
        get { return TxtVal.Value; }
        set
        {
            TxtVal.Value = value;
            PV.NavigateUrl = value;
        }
    }


    //public string SelIcon {
    //    get { return SelButton.ImageUrl; }
    //    set { SelButton.ImageUrl = value; }
    //}
    public bool LinkVisible {
        get { return PV.Visible; }
        set { PV.Visible = value; }
    }

    public string LinkText {
        get {
            return PV.Text;
        }
        set {
            PV.Text = value;
        }
    }

    public string SelText
    {
        get
        {
            return SelButton.Text;
        }
        set {
            SelButton.Text = value;
        }
    }

    protected void LinkButton1_Click(object sender, EventArgs e)
    {
        Value = string.Empty;
    }

    #region ITextControl 成员

    public string Text
    {
        get
        {
            return Value;
        }
        set
        {
            Value = value;
        }
    }

    #endregion
}
